From: Marco Trevisan (TreviƱo) Date: Mon, 16 Feb 2026 20:29:10 +0000 (+0100) Subject: search: Catch async function errors and log them unless cancelled X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~26^2~1^2~53 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=37d5b68f3d3fd828e3eabeaa3d9c06376c8c69d6;p=gnome-shell.git search: Catch async function errors and log them unless cancelled In case a search function fails, we are not providing clear errors, thus trace the errors when calling async functions from sync ones and when catching errors. Note that at the moment is unlikely to receive any cancelled error here, since the remote search providers calls handle the error already, but we still use `logErrorUnlessCancelled` instead of `logError` to be more future proof or to cover the case in which some extension may throw a cancelled error. Part-of: --- diff --git a/js/ui/search.js b/js/ui/search.js index 361475e2f..99b8725da 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -15,6 +15,7 @@ import {ensureActorVisibleInScrollView} from '../misc/animationUtils.js'; import {Highlighter} from '../misc/util.js'; import {Spinner} from './animation.js'; +import {logErrorUnlessCancelled} from '../misc/errorUtils.js'; const SEARCH_PROVIDERS_SCHEMA = 'org.gnome.desktop.search-providers'; @@ -274,7 +275,8 @@ const SearchResultsBase = GObject.registerClass({ resultId => this._addItem(this._resultDisplays[resultId])); this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0); this.show(); - } catch { + } catch (e) { + logErrorUnlessCancelled(e); this._clearResultDisplay(); } } @@ -511,7 +513,7 @@ class GridSearchResults extends SearchResultsBase { const laters = global.compositor.get_laters(); this._updateSearchLater = laters.add(Meta.LaterType.BEFORE_REDRAW, () => { delete this._updateSearchLater; - super.updateSearch(...args); + super.updateSearch(...args).catch(logErrorUnlessCancelled); return GLib.SOURCE_REMOVE; }); }); @@ -713,7 +715,8 @@ export const SearchResultsView = GObject.registerClass({ this._providers.forEach(provider => { const previousProviderResults = previousResults[provider.id]; - this._doProviderSearch(provider, previousProviderResults); + this._doProviderSearch(provider, previousProviderResults).catch( + logErrorUnlessCancelled); }); this._updateSearchProgress();